package com.naiterui.ehp.bs.weixin.controller.inner;

import com.naiterui.ehp.bp.constants.SwaggerTag;
import com.naiterui.ehp.bp.support.exception.PublicService;
import com.naiterui.ehp.bp.support.exception.ResponseVO;
import com.naiterui.ehp.bs.weixin.service.QrCodeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 小程序二维码内部类
 *
 * @author guoyongxiang
 * @version 1.0.0
 * @date 2022/10/21 17:54
 **/
@Slf4j
@Api(tags = {SwaggerTag.WEIXIN + SwaggerTag.INNER_API + SwaggerTag.OTHER})
@RestController
@RequestMapping("weixin/inner/qrcode")
@RequiredArgsConstructor
public class InnerQrCodeController {

    private final QrCodeService qrCodeService;

    @ApiOperation(value = "微信小程序二维码")
    @GetMapping("/wx/ma/unlimited")
    public ResponseVO<String> miniappQrcode(String scene, String page) throws Exception {
        log.info("生成无限小程序码 scene:{}, page:{}", scene, page);
        return PublicService.returnResponseVO(qrCodeService.getMaUnlimitedQRCodeUrl(scene, page));
    }
}
